<template>
	<view class="content">
		<view class="payBtn" @click="showPay=1">
			点击支付
		</view>
		<Jhpay-Cashier
			:apiUrl="apiUrl"
			:showPay.sync='showPay'
			:data='orderInfo'
			@payResult='payResult'
		></Jhpay-Cashier>
	</view>
</template>

<script>
	import JhpayCashier from '@/components/suixiang-jhpay/index.vue'
	export default {
		data() {
			return {
				apiUrl: 'https://paydemo.chatdong.cn/pay', //示例，需要改成你自己的地址
				showPay: 0,
				orderInfo: { //自定义数据，一般为订单信息
					order_id: 1
				}
			}
		},
		components: {
			JhpayCashier
		},
		onLoad() {

		},
		methods: {
			payResult(data) {
				console.log("payResult", data)
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	.payBtn {
		width: 300rpx;
		height: 80rpx;
		line-height: 80rpx;
		margin: auto;
		margin-top: 800rpx;
		background-color: rgb(34, 172, 56);
		text-align: center;
		color: #fff;
		border-radius: 10rpx;
	}
</style>
